<?php if (!defined('BASE')) {die('No direct file access.');}

//********************************
//	File:		connection.php
//	Author:		Philip Pryce
//	Date:		20th July 2008
//	Comments:	A database example.
//********************************

class Connection extends Controller {
	
	function index () {
		
		$SM = getInstance();
		$SM->loadLibrary('database');
		
		$sql = "SELECT * FROM example";
		$binds = array(1, true, 'date');
		
		$result = $SM->database->query($sql, $binds);
		
		echo '<pre>';
		echo 'SQL:		' . $sql . "\n";
		echo 'Binds:		';
		print_r($binds);
		echo "\n";
		echo 'Binded:		' . $SM->database->replaceBinds($sql, $binds) . "\n";
		echo 'SQL Result:	';
		print_r($result->rows());
		echo '</pre>';
		
		unset($SM);
	}
	
}

?>